// 登录接口，不使用 token
import axiosInstance from '@/utils/http'

export interface LoginData {
  username: string
  password: string
}

export function login(data: LoginData): Promise<R<Token>> {
  return axiosInstance.post<R<Token>>('/security/login', { data })
}

export function logout(): Promise<R<number>> {
  return axiosInstance.post<R<number>>('/security/logout')
}

export function refresh(refreshToken: string): Promise<R<Token>> {
  return axiosInstance.post<R<Token>>('/security/refresh', { data: { refreshToken } })
}
